import { Body, Inject, Provide, Get, Post } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { browserService } from '../../service/browserService';
import { Validate } from '@midwayjs/validate';

/**
 * 远程RPC调用
 */
@CoolController()
export class BrowserController extends BaseController {
  @Inject()
  browserService: browserService;

  @Post('/page', { summary: '网站地址分页列表' })
  @Validate()
  async pageInfo(@Body() body) {
    const params = {
      name: 'plugin',
      service: 'PluginWebsiteService',
      method: 'page',
      params: body,
    };
    return this.ok(await this.browserService.call(params));
  }
 
  @Post('/del', { summary: '网站地址分页列表' })
  @Validate()
  async del(@Body() body) {
    const params = {
      name: 'plugin',
      service: 'PluginWebsiteService',
      method: 'delete',
      params: body,
    };
    return this.ok(await this.browserService.call(params));
  }
  @Post('/add', { summary: '网站地址分页列表' })
  @Validate()
  async addinfo(@Body() body) {
    const params = {
      name: 'plugin',
      service: 'PluginWebsiteService',
      method: 'add',
      params: body,
    };
    return this.ok(await this.browserService.call(params));
  }
  @Post('/update', { summary: '网站地址分页列表' })
  @Validate()
  async updateinfo(@Body() body) {
    const params = {
      name: 'plugin',
      service: 'PluginWebsiteService',
      method: 'update',
      params: body,
    };
    return this.ok(await this.browserService.call(params));
  }

}